<?php
class CouponList extends AppModel
{
    public $name = 'CouponList';
    public $useDbConfig = 'fantasy_hero_kr';
    public $primaryKey = '_id';

    public function coupon_list()
    {
        $params = array(
            'conditions' => array(),
            'group' => 'agent',
        );

        $data = $this->find('first', $params);
        return $data;
    }

    public function getForExcel()
    {
        $params = array(
            'conditions' => array(
               'limit'=>5000
            ),
            'fields' => array('coupon_id', 'end_time', 'start_time', 'use_limit', 'agent', 'reward')
        );

        $data = $this->find('all', $params);
        return $data;
    }

    public function getForExcel_2()
    {
        $params = array(
            'conditions' => array(
                'Id' => array(
                    '$nin' => array('')
                )
            ),
            'fields' => array('coupon_id', 'end_time', 'start_time', 'use_limit', 'agent', 'reward')
        );

        $data = $this->find('all', $params);
        return $data;
    }

    public function getForExcel_3()
    {
        $params = array(
            'conditions' => array(
                'Id' => array(
                    '$nin' => array('')
                )
            ),
            'fields' => array('coupon_id', 'end_time', 'start_time', 'use_limit', 'agent', 'reward')
        );

        $data = $this->find('all', $params);
        return $data;
    }

    public function getForExcel_4()
    {
        $params = array(
            'conditions' => array(
                'Id' => array(
                    '$nin' => array('')
                )
            ),
            'fields' => array('coupon_id', 'end_time', 'start_time', 'use_limit', 'agent', 'reward')
        );

        $data = $this->find('all', $params);
        return $data;
    }
}